import { Component, OnInit, ViewEncapsulation  } from '@angular/core';
import { Observable, Subscriber } from 'rxjs/Rx';

@Component({
  selector: 'app-outpatientpay',
  templateUrl: './outpatientpay.component.html',
  styleUrls: ['./outpatientpay.component.css'],
  encapsulation: ViewEncapsulation.None
})
export class OutpatientpayComponent implements OnInit {

  //暂时不要动这文件，数组有bug

  res: any = {
    cho2: true,
    worldpost: '1',
    contact: '1',
    country: '1',
    agree: true
  };

  info: any[] = [
    { 'name': '检查费', 'price': '500' },
    { 'name': '西药费', 'price': '300' },
    { 'name': '挂号费', 'price': '200' }
  ];

  cheinfo: any[]=[];

  constructor() {
  }

  payorder(){
    console.log(this.cheinfo)
  }

  check(ev,i){
    console.log(i)
    console.log(this.info[i].name)
    this.cheinfo.push(this.info[i])
  }

  checkall(ev) {
    this.cheinfo.push(this.info)
    this.info.forEach(x => x.state = ev.target.checked);
  }
  
  checkedall() {
    return this.info.every(_ => _.state);
  }

  ngOnInit() {
  }

}
